package com.qsd.doc4jsimpple.constants;

import lombok.Getter;

/**
 * * @Author xujunxia
 * * @Date 2024-11-04 19:17
 * * @Description TODO
 * * wb-0455@dtdream.com
 **/
@Getter
public enum ComponentTypeEnum {

    Heading("heading","标题"),

    Paragraph("paragraph","段落"),

    Text("text","普通文本"),

    OrderedList("orderedList","点状列表"),

    ListItem("listItem","有序/无序列表的元素"),

    BulletList("bulletList","有序列表"),

    Image("imageBlock","图片"),

    ;
    /**
     * 编号
     */
    private String code;
    /**
     * 名称
     */
    private String name;

    ComponentTypeEnum(String code, String name) {
        this.code = code;
        this.name = name;
    }

    public static String getName(String code) {
        for (ComponentTypeEnum type : ComponentTypeEnum.values()) {
            if (type.getCode().equals(code)) {
                return type.name;
            }
        }
        return null;
    }


    public static ComponentTypeEnum getEnum(String code) {
        for (ComponentTypeEnum type : ComponentTypeEnum.values()) {
            if (type.getCode().equals(code)) {
                return type;
            }
        }
        return null;
    }




}
